using System;
using System.Collections.Generic;
using System.Text;

namespace BTV.Base.Search.SearchTypes
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1705:LongAcronymsShouldBePascalCased")]
    public class BTVNameMatchSearchType : BTVBaseSearchType
    {

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")]
        public override bool MatchProgramWithCriteria(BTVProgram input)
        {
            if (!IsValid)
            {
                throw new ArgumentException("Criteria was null of not a string");
            }

            string sCriteria = Criteria as string;
            return Operator.PerformEquality(input.Name.ToLower(), sCriteria.ToLower());
        }

        public override bool IsValid
        {
            get
            {
                if (Operator == null || Criteria == null || Criteria.GetType() != typeof(string))
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
        }
    }
}
